package com.eastjet.maintenance.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eastjet.maintenance.domain.AssociatedDevices;
import com.eastjet.maintenance.mapper.AssociatedDevicesMapper;
import com.eastjet.maintenance.service.AssociatedDevicesService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 杨博文
 * @description 针对表【associated_devices(关联设备)】的数据库操作Service实现
 * @createDate 2024-11-25 09:23:37
 */
@Service
public class AssociatedDevicesServiceImpl extends ServiceImpl<AssociatedDevicesMapper, AssociatedDevices> implements AssociatedDevicesService {

    /*
     * 新增关联设备
     */
    @Override
    public Boolean InsertAssociatedDevices(List<AssociatedDevices> associatedDevices) {
        return this.saveBatch(associatedDevices);
    }

    /*
     * 修改关联设备/删除关联设备
     */
    @Override
    public Boolean UpdateAssociatedDevices(List<AssociatedDevices> associatedDevices) {
        return this.updateBatchById(associatedDevices);
    }

    /*
     * 查询关联设备
     */
    @Override
    public Boolean DeleteAssociatedDevices(List<String> code) {
        return this.removeByIds(code);
    }

    /*
     * 查询关联设备
     */
    @Override
    public List<AssociatedDevices> SelectAssociatedDevicesByCode(String code) {
        return this.list(new QueryWrapper<AssociatedDevices>().and(i -> i.eq("code", code).eq("tombstone", 0)));
    }
}




